#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: mysql01.py 
@version:
@time: 2032/01/17
"""
from bson.int64 import Int64
from bson import Decimal128, MaxKey, MinKey, Code
from bson.regex import Regex
from bson.timestamp import Timestamp
from bson.binary import Binary, UUIDLegacy, STANDARD
from bson.json_util import JSONMode
from bson.objectid import ObjectId
import uuid
from datetime import datetime

from TapClientCaseData.ColumnGenerateData.dynamic.base.base00_dynamic import MONGODB03_TYPE
from TapClientCaseData.ColumnGenerateData.dynamic.base.base00_dynamic import generate_columns_data

my_uuid = uuid.uuid4()

MONGODB03_COLUMNS = MONGODB03_TYPE.get('COLUMNS')

BASE = MONGODB03_COLUMNS.get('BASE')
BASE_DDL_MONGODB_CREATE = BASE.get('CREATE')
BASE_DDL_MONGODB_INSERT = BASE.get('INSERT')
BASE_DDL_MONGODB_UPDATE = BASE.get('UPDATE')
BASE_DDL_MONGODB_WHERE = BASE.get('WHERE')

#  create, insert require list
insert_create_list = [
    BASE_DDL_MONGODB_CREATE,
    BASE_DDL_MONGODB_INSERT,
]
for insert in insert_create_list:
    if type(insert) is not list:
        raise Exception

# ALL TYPE

PK = {'pk': 1}
DOUBLE = {'DOUBLE': 1.1}
STRING = {'STRING': 'tapdata'}
OBJECT = {'OBJECT': {"tapdata": "dfs,daas,dds,drs"}}
ARRAY = {'ARRAY': ["a", "b", "c"]}
BINARY_DATA = {'BINARY_DATA': Binary(my_uuid.bytes, 3)}
UNDEFINED = {'UNDEFINED': None}
# Deprecated 4.4
OBJECTID = {'OBJECTID': ObjectId()}
BOOLEAN = {'BOOLEAN': True}
DATE = {'DATE': datetime.utcnow()}
NULL = {'NULL': None}
REGEX = {'REGEX': Regex('test')}
# DBPOINTER = ... Deprecated
JAVASCRIPT = {'JAVASCRIPT': Code('function(){ t = 1}')}
# SYMBOL = ... Deprecated
# JAVASCRIPT_WITH_SCOPE = Code('var t = 1; function(){ t = 1}') Deprecated
INT32 = {'INT32': 1}
INT64 = {'INT64': Int64(1000)}
TIMESTAMP = {'TIMESTAMP': Timestamp(1, 1)}
DECIMAL128 = {'DECIMAL128': Decimal128('1')}
MINKEY = {'MINKEY': MinKey()}
MAXKEY = {'MAXKEY': MaxKey()}
# MinKey and MaxKey are MongoDB internal types. Their purpose is to represent the theoretical extremes.
#
# MinKey is less than any value, and MaxKey is greater than any value, regardless of type.
